<?php 
class PostItem extends Module{
	function PostItem($row){
		Module::Module($row);
				
		if(User::is_login())
		{
			if(!User::have_permit(ADMIN_ITEM) || User::is_block())
			{
          	 	Url::access_denied();     
			}
			else{
				if(Url::get('cmd') == 'edit')
				{
					if(Url::get('id'))
					{
						require_once 'forms/EditItemForm.php';
						$this->add_form(new EditItemForm());
						return;				
	                }
                }
				
                if(Url::get('cmd') != '')
				{
					Url::redirect_current();
				}

				require_once 'forms/PostItemForm.php'; 
				$this->add_form(new PostItemForm());
			}
		}
		else
		{
			AZLib::check_uri();	
			Url::redirect_url('?page=sign_in&href='.base64_encode(CGlobal::$query_string));
		}
	}
}
?>